package com.vim.common.model.response;

import io.swagger.annotations.ApiModelProperty;

/**
 * Restful响应基类
 */
public class RestfulResponse implements Response{

    //默认系统错误
    public static final int DEFAULT_ERROR = 500;

    //普通验证码错误
    public static final int VERIFY_CODE_ERROR = 501;

    //登录过期错误
    public static final int LOGIN_EXPIRE_ERROR = 800;

    //发送验证失败
    public static final int SEND_PHONE_CODE_ERROR = 801;

    //登录失败
    public static final int LOGIN_ERROR = 802;

    //默认成功
    public static final int DEFAULT_OK = 20000;

    public static final String DEFAULT_MSG = "OK";

    /** 状态码 */
    @ApiModelProperty("返回标识符")
    private int code = DEFAULT_OK;

    /** 状态消息 */
    @ApiModelProperty("返回信息")
    private String msg = DEFAULT_MSG;

    /** 响应数据 */
    @ApiModelProperty("返回数据")
    private Object data;

    public RestfulResponse(){}

    public RestfulResponse(Object data){
        this.data = data;
    }

    public RestfulResponse(int code, String msg){
        this.code = code;
        this.msg = msg;
    }

    public RestfulResponse(int code, String msg, Object data){
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
